const prd = $('.product')
const product1 = $('.product1')

function prdhover() {
    prd.hover(function (event) {
            $('.wrap').stop().animate({'height': '840px'}, 280)
        },
        function (event) {
            $('.wrap').stop().animate({'height': '627px'}, 280)
        }
    )
}
function product1hover() {
    product1.hover(function (event) {
            $(this).find('.wrap-detail').stop().animate({'height': '213px'}, 150)
        },
        function (event) {
            $(this).find('.wrap-detail').stop().animate({'height': '0'}, 200)
        }
    )
}
function autoply() {
    var wrap = $('.wrap-annouce')
    var text2 = $('.annouce-text2')
    setInterval(function () {
        if (wrap.scrollLeft() >= text2.width())
        {
            wrap.scrollLeft(wrap.scrollLeft()-text2.width())
        }
        else {
            wrap.scrollLeft(wrap.scrollLeft()+1)
        }
    },50)
}
function jumpnumber( startnumb, targetnumb, selecter,step, speed) {
    var stepnum = 0
    var numbjump = setInterval(function(){
        let strstartnumber = startnumb
        stepnum +=step
        strstartnumber += stepnum
        $(selecter).text(strstartnumber)
        if(strstartnumber >= targetnumb){
            clearInterval(numbjump)
        }
    },speed)
}

export {prdhover, product1hover, autoply, jumpnumber}